// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SALES_RO
// * CreateDate    : 2014-03-27 22:08:56
// * Creater       : CodeSmith
// * LastChangeDate: 2014-03-27 22:08:56
// * LastChanger   : 2014-03-27 22:08:56
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Sales
{
/// <summary>
    /// SalesRo
    /// </summary>
    public partial class SalesRoBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objSalesRoEntity">Entity</param>
        /// <returns>Entity</returns>
        public static SalesRoEntity GetSalesRo(SalesRoEntity objSalesRoEntity)
        {
            return DataAccess.SelectSingle<SalesRoEntity>(objSalesRoEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objSalesRoEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertSalesRo(SalesRoEntity objSalesRoEntity)
        {
            return DataAccess.Insert(objSalesRoEntity);
        }

        public static bool InsertSalesRo(List<SalesRoEntity> objSalesRoEntityList)
        {
            return DataAccess.Insert(objSalesRoEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objSalesRoEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateSalesRo(SalesRoEntity objSalesRoEntity)
        {
            return DataAccess.Update(objSalesRoEntity);
        }

        public static bool UpdateSalesRo(List<SalesRoEntity> objSalesRoEntityList)
        {
            return DataAccess.Update<SalesRoEntity>(objSalesRoEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objSalesRoEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteSalesRo(SalesRoEntity objSalesRoEntity)
        {
            return DataAccess.Delete(objSalesRoEntity);
        }

        public static bool DeleteSalesRo(List<SalesRoEntity> objSalesRoEntityList)
        {
            return DataAccess.Delete<SalesRoEntity>(objSalesRoEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetSalesRoAll()
        {
            return DataAccess.SelectAllDataSet<SalesRoEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<SalesRoEntity> GetSalesRoAllList()
        {
            return DataAccess.SelectAll<SalesRoEntity>();
        }
        #endregion

        public static List<SalesRoEntity> GetSalesRoForCustomerSummary(List<string> salesAppIdList)
        {
            string sql = @"select ro.* from SALES_RO ro where ro.IS_ACTIVE=1 and ro.STATUS='WFS35' and ro.SALES_APP_ID in ({0})";
            string sql2 = "";
            foreach (string appId in salesAppIdList)
            {
                sql2 += "'" + appId + "',";
            }
            sql2 = sql2.Substring(0, sql2.Length - 1);
            sql = string.Format(sql, sql2);
            return DataAccess.Select<SalesRoEntity>(sql);
        }

	}
	
	
}	

